package com.production.CoursePlatform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.production.CoursePlatform.entity.Teacher;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface TeacherMapper extends BaseMapper<Teacher> {

    // 根据 tID 查询单个 Teacher 记录
    @Select("SELECT * FROM teacher WHERE t_id = #{tID}")
    Teacher findByTID(@Param("tID") String tID);

    // 插入新的 Teacher 记录
    @Insert("INSERT INTO teacher (t_id, t_name, t_gender, t_title) " +
            "VALUES (#{tID}, #{tName}, #{tGender}, #{tTitle})")
    int insertTeacher(Teacher teacher);

    // 更新 Teacher 记录
    @Update("UPDATE teacher SET t_name = #{tName}, t_gender = #{tGender}, t_title = #{tTitle} WHERE t_id = #{tID}")
    int updateTeacher(Teacher teacher);

    // 删除 Teacher 记录
    @Delete("DELETE FROM teacher WHERE t_id = #{tID}")
    int deleteByTID(@Param("tID") String tID);
}

